package com.qingge.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qingge.springboot.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

// @Mapper
@Repository
public interface UserMapper extends BaseMapper<User> {

//    @Select("SELECT * from sys_user")
//    List<User> findAll();
//
//    @Insert("INSERT into sys_user(username,password,nickname,email,phone,address) VALUES (#{username},#{password}, + " +
//            "#{nickname},#{email},#{phone},#{address})")
//    int insert(User user);
//
//    int update(User user);
//
//    @Delete("delete from sys_user where id = #{id}")
//    Integer deleteById(@Param("id") Integer id); // 这个注解里面的名字跟sql语句的一模一样
//
//    @Select("select * from sys_user where username like concat('%',#{username},'%') limit #{pageNum},#{pageSize}")
//    //@Select("select * from sys_user where username like concat('%',#{username},'%') and IFNULL(email,'') like concat('%',#{email},'%') and address like concat('%',#{address},'%') limit #{pageNum},#{pageSize}")
//    // 也可以这样写 @Select("select * from sys_user where like limit #{pageNum},#{pageSize}") 不过要在函数里面写 username = '%' + username + '%';
//    List<User> selectPage(Integer pageNum, Integer pageSize,String username);
//    //List<User> selectPage(Integer pageNum, Integer pageSize,String username,String email,String address);
//
//
//
//    @Select("select count(*) from sys_user where username like concat('%',#{username},'%')")
//    //@Select("select count(*) from sys_user where username like concat('%',#{username},'%') and IFNULL(email,'') like concat('%',#{email},'%') and address like concat('%',#{address},'%')")
//        //也可以这样写 @Select("select count(*) from sys_user where usernam like #{username}) 不过要在函数里面写 username = '%' + username + '%';
//    Integer selectTotal(String username);
//    //Integer selectTotal(String username,String email,String address);

}
